UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WEmGbul9sUGrbEvtAKgL8/dpj1Szs5OaAGLHsy67HCU='
WHERE
key_id = '11984a4f23f5364f98c851f2c4a8816017352d62565898e986f82b1e887d697b'
AND (
token = 'WEmGbul9sUGrbEvtAKgL8/dpj1Szs5OaAGLHsy67HCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)