UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NZ1QPpfTfj8O3vph+ICF552yWbyly+SBlSzxKZUqDnk=' 
WHERE 
  key_id = 'c21f232d4951192bb71f573f47e9951721f9ad6a1e6f6c87683e3d3ccd909304' 
  AND (
    token = 'NZ1QPpfTfj8O3vph+ICF552yWbyly+SBlSzxKZUqDnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022