UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j25APm+dDnk8sbx0WKR8q1lzVu2S+mg7KskgPhbQE0w=' 
WHERE 
  key_id = 'af5ba5232779fe90045dfe1d337ce8eec18e61e6b3e34ffef00a93e9fc2b43b1' 
  AND (
    token = 'j25APm+dDnk8sbx0WKR8q1lzVu2S+mg7KskgPhbQE0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029