UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pG1oojImPyroTFAYICdh+0xgnitBMWsok1x7ra013+U='
WHERE
key_id = '5e6e7789de8bb4219669a3a845f561e41b6371f6ea9d7eecde50d7bdb8e6e157'
AND (
token = 'pG1oojImPyroTFAYICdh+0xgnitBMWsok1x7ra013+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)