UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OI8ilAz6y08kwFVOUsqJ7nB88Jg86dR1zP+DjqWj1zs=' 
WHERE 
  key_id = '7d337064820f9af53c41d2e5f150f5821bc8d2052bc153b9a2cdf2e4dc76a573' 
  AND (
    token = 'OI8ilAz6y08kwFVOUsqJ7nB88Jg86dR1zP+DjqWj1zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021