UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sCoryLdUCY6LG52OMBVgy9oKcr4axRFsyV/ekAZm6Tg='
WHERE
key_id = 'b67fa15f5fde3860c13b48fe7141ef0e264a41e03778c4e3ab26580c951171a7'
AND (
token = 'sCoryLdUCY6LG52OMBVgy9oKcr4axRFsyV/ekAZm6Tg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)