UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AH25tlE0Eix+KLOwpmF7ypNUHJE9YVQTXC736+tSxCs='
WHERE
key_id = '54ad559cf386f9cf4b4c2bd41b99067d60085fe8a7be6bcff6d0191fbbfb573d'
AND (
token = 'AH25tlE0Eix+KLOwpmF7ypNUHJE9YVQTXC736+tSxCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)