UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l+oay39p8zyNwaEDJlqLpgNDy3EZoHOrpNVqm1Bxcu4='
WHERE
key_id = 'd455f115841895ad1e9949caf98ecd6bdff3f5a3027d039d44fd7273731d0251'
AND (
token = 'l+oay39p8zyNwaEDJlqLpgNDy3EZoHOrpNVqm1Bxcu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)