UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k1ViE1t7uepgxAEYhB/iyI2I7EpGXN+HlzNJIMVCVsA='
WHERE
key_id = 'f7a6b5e18a3f46f45395e551ab627d0f4c2d2b5311e24309a16febe052188dbe'
AND (
token = 'k1ViE1t7uepgxAEYhB/iyI2I7EpGXN+HlzNJIMVCVsA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)