UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uSrFG244z7agSWxHw5dBNXoZNENrz7rqfgTspQKRcFE=' 
WHERE 
  key_id = '90ff6b9bdd2f27aa13d3d0dba613c8b264ac372912a97d3ed62ba34cab9d4498' 
  AND (
    token = 'uSrFG244z7agSWxHw5dBNXoZNENrz7rqfgTspQKRcFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028