UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'huyznmHfOOUa87J9u/msxd4WxxvQHXgMT/5ZFcl2si0=' 
WHERE 
  key_id = '667777cfd10acd74c774daa3f9389061fc1d9a32cf373af176f0eb0bcfe2242d' 
  AND (
    token = 'huyznmHfOOUa87J9u/msxd4WxxvQHXgMT/5ZFcl2si0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045