UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eECemYBsTNacVl0XPNsbRpP6a41PVcuaPw1Q+c2Ayo8='
WHERE
key_id = '3a14cb97730090a033950cab3ecf6298fe90cc0fd214c463cfb100d47cf99e9b'
AND (
token = 'eECemYBsTNacVl0XPNsbRpP6a41PVcuaPw1Q+c2Ayo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)