UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't0NZAdwko/rROcE0AIiKd/baghpfcVj96Bx6PovNWCI=' 
WHERE 
  key_id = '9d5181a75e3428925d949229eda91b9300e7b8e6f91b6f88a298be90027dc1e7' 
  AND (
    token = 't0NZAdwko/rROcE0AIiKd/baghpfcVj96Bx6PovNWCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061