UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYGdwhdH/6CSGOrEqed9uUi1nEGz99IbMz4TgUd4kY4='
WHERE
key_id = 'e8690dd019cc613f60509ebb3aff784b608fdcc277c1e88787e3af8d1e551c05'
AND (
token = 'xYGdwhdH/6CSGOrEqed9uUi1nEGz99IbMz4TgUd4kY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)