UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Btex8EHFjIMWK/THlWKIiAdSz7u2Ve9+TWKap55aH3A=' 
WHERE 
  key_id = '6ae659ef6ac2b97692c682b29bf74779e54fc730a28abc5496a78e2b3befffdd' 
  AND (
    token = 'Btex8EHFjIMWK/THlWKIiAdSz7u2Ve9+TWKap55aH3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032