UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IofmN+DT+wyedcFP5HC1loVloXz+hMKkdo9GZ9oPqms=' 
WHERE 
  key_id = 'e3be33c437899b184aff02a1fcc00502779899e51527424c4299714acd4a0d3f' 
  AND (
    token = 'IofmN+DT+wyedcFP5HC1loVloXz+hMKkdo9GZ9oPqms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030