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