UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qA5/Y/IWzhr9UEOb93NcqhbtwDr69aPasb4NMfa+aH4='
WHERE
key_id = 'f66d7d9255e2bfc12afd75c0ed07390d9504fc09ca9909df9dfacef368905519'
AND (
token = 'qA5/Y/IWzhr9UEOb93NcqhbtwDr69aPasb4NMfa+aH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)