UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kr7cFZZcSJaX2XB82iSfu+CjHkYmI5qmNljB4Ca/9ks=' 
WHERE 
  key_id = '9956ba7168ea73983efed6beaf3513916d2b4be9186ebe8946df27797bdd0387' 
  AND (
    token = 'Kr7cFZZcSJaX2XB82iSfu+CjHkYmI5qmNljB4Ca/9ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032