UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BcMn28iBteYv0RN+aDWLw/Zg2oJQh2RHujFr13FWdRk=' 
WHERE 
  key_id = '409a79b9876df9010b889af39075eb258f5b65c6942964aa2dd53753bbdeeba0' 
  AND (
    token = 'BcMn28iBteYv0RN+aDWLw/Zg2oJQh2RHujFr13FWdRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047