UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jgMcKoTdA1ZM2q079I0pyUJjkI+9P331X420h1z/PaU='
WHERE
key_id = '2aaacc814fcc8ff027f19e4ea406418b35213ac0f641e24cf68ad182254e2ead'
AND (
token = 'jgMcKoTdA1ZM2q079I0pyUJjkI+9P331X420h1z/PaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)