UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iP6eJUefXdyU61A0H090d0nu029K8xi2dZqlqxXH2zA=' 
WHERE 
  key_id = '4c677ca54eb054e8469161db2a9700cbe1515e7d72a9939a06ae8fb1848e18b9' 
  AND (
    token = 'iP6eJUefXdyU61A0H090d0nu029K8xi2dZqlqxXH2zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032