UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knU3LO1eYM/iEvnHs3KNQN261RRAK575UFJCjfUYxOQ=' 
WHERE 
  key_id = '2a38c1072c3373eedc4cd141ab4d813ffc90fe516f6b9ab2e8886463fe8e153a' 
  AND (
    token = 'knU3LO1eYM/iEvnHs3KNQN261RRAK575UFJCjfUYxOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077