UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ga30WMplpXuaieP5dgQxrkfKr9pUrEvHp33qTHVaBL4='
WHERE
key_id = 'bdb7d6b51bec37c98e2da845d1b49cd62d1d86fcfb305406b27a870d30b048fc'
AND (
token = 'Ga30WMplpXuaieP5dgQxrkfKr9pUrEvHp33qTHVaBL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)