UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8U5vnS7+Su2NnXC8FBoRTlYbHR1g0vwH0x2l3tn2sw='
WHERE
key_id = '0f362bd9fe0575f9e5be7fb161f225d2697e037f478cd396a1a20e4310b605d6'
AND (
token = 'g8U5vnS7+Su2NnXC8FBoRTlYbHR1g0vwH0x2l3tn2sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)