UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ep4PSPXsrft08fbMQbJRGCc0SD8YJm/cHRtT0eUzegY=' 
WHERE 
  key_id = '7814baa9836e397b02993674732921a09078c4a671647182e68547c4835e1a7c' 
  AND (
    token = 'ep4PSPXsrft08fbMQbJRGCc0SD8YJm/cHRtT0eUzegY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044