UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lykdpwaeSCtCgDtxFN4fS/+EE02tUOovB2Dr2FuLvJs='
WHERE
key_id = 'ba9c6718b865a5787d80c9a22b5e95d5551ecb0b1e940a1b309e4862449208ef'
AND (
token = 'lykdpwaeSCtCgDtxFN4fS/+EE02tUOovB2Dr2FuLvJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)