UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rcUhVzDAwGpM8EgfVpwW4Q8TUombr69LBLSX4ZG3fGU=' 
WHERE 
  key_id = '77da5f652d9b083869beac7212147894df8eb364412ee548f04542195327c2e5' 
  AND (
    token = 'rcUhVzDAwGpM8EgfVpwW4Q8TUombr69LBLSX4ZG3fGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045