UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TcpKm/8GVIz+L5UJr/U3IcJ0e0igm0VrH+fRkTLhJxo=' 
WHERE 
  key_id = '6b0e88c7885d14ab70175bba1ce9674ec9af4804aefe01a4ccae3846c3586f73' 
  AND (
    token = 'TcpKm/8GVIz+L5UJr/U3IcJ0e0igm0VrH+fRkTLhJxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037