UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZIjteAl9RrfmXP6e4quzqmA32nBW76cwmBMsxfJTgG8=' 
WHERE 
  key_id = '5a1d97e0ace76264d958470c0787a17ce8274fcf9d3e8d0d09ad808ace6a3189' 
  AND (
    token = 'ZIjteAl9RrfmXP6e4quzqmA32nBW76cwmBMsxfJTgG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020