UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UmhXtS+ce9HjjtMIMW60wVCLbTfZnYp8sfUKrlq49K0='
WHERE
key_id = '58a47f8ba23b01231abaf9f00579a264b9c96bf8a4c44c5849a7daa36c8fb2db'
AND (
token = 'UmhXtS+ce9HjjtMIMW60wVCLbTfZnYp8sfUKrlq49K0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)