UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eJIxAZxpjk7B5pEDc9o6NURGRqFplUKFs7sZDVfty8Q=' 
WHERE 
  key_id = '7888ebca7c905776a962f546736e7242a304ef4f635e030e8413f6767cce33c0' 
  AND (
    token = 'eJIxAZxpjk7B5pEDc9o6NURGRqFplUKFs7sZDVfty8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039