UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dH9Sn5mySFGhKw5d/64Cykf5GQhRCb8nv2nxbtPi7HI=' 
WHERE 
  key_id = '646247fb25e9d87d50277fb31286c55cd96301423070ee8d9d07697433dd9fb3' 
  AND (
    token = 'dH9Sn5mySFGhKw5d/64Cykf5GQhRCb8nv2nxbtPi7HI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029