UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4hfxCJFpnW5eOh9HLE9el90msXUDGJpt/OLkyRwpcow='
WHERE
key_id = 'b2c2c3391991f47557189eb9016bc390964b227c5035422f460418d2d14386e9'
AND (
token = '4hfxCJFpnW5eOh9HLE9el90msXUDGJpt/OLkyRwpcow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)