UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qMK4BEpwR940m29Nn/OJZgm7uWiC3h6GDws1qPn3ZmA=' 
WHERE 
  key_id = '99306599c960b8915fecd4c6b41e4df65df16fe6894aba42429d0d2f988f876c' 
  AND (
    token = 'qMK4BEpwR940m29Nn/OJZgm7uWiC3h6GDws1qPn3ZmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017