UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cfpCg+ZPkYTur8nZcZyD1TuCuB/kyN+EWzcpX+i9AFI=' 
WHERE 
  key_id = '794d6dc302fec839a648b3e52f8985cde24c804474c977d91ff18f5f4d0ab66b' 
  AND (
    token = 'cfpCg+ZPkYTur8nZcZyD1TuCuB/kyN+EWzcpX+i9AFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025