UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VKfq6EKiFy3r1n9IZQ04NyOe+drQatZnnbje1paHlY0='
WHERE
key_id = '07a1a735aead09814f58f6bd1ef0a5bd079d14243e8a6bcf120a062c02a13a52'
AND (
token = 'VKfq6EKiFy3r1n9IZQ04NyOe+drQatZnnbje1paHlY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)