UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V8Np4Yn+qfMdCCdrU7riKG6+r6npzQRpArLba5vlSiw='
WHERE
key_id = 'd44a88f807ca56875f79e2dc799716361eb7d3893599100b073efc925d8461cb'
AND (
token = 'V8Np4Yn+qfMdCCdrU7riKG6+r6npzQRpArLba5vlSiw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)