UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oYQgb7GrLmrf2njNDWKUroHrPCQDAnS784JnD+UIcFE=' 
WHERE 
  key_id = '1ac30d1cb0e0dd4baa6ab08d2df29fdab8ce4d89486b0b185cfd2107259265ab' 
  AND (
    token = 'oYQgb7GrLmrf2njNDWKUroHrPCQDAnS784JnD+UIcFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028