UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XezkPOV/x9NjQkWdvUiIlN0rkQDF1i0twLQtRV8Cdec='
WHERE
key_id = 'a214ba9a10de1cc352ee618e95042bf357d7c2b8dc786d02f1e421125c54e381'
AND (
token = 'XezkPOV/x9NjQkWdvUiIlN0rkQDF1i0twLQtRV8Cdec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)