UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vshCbOf7kw1deLBT9L4dGflr+j0c7/PL+O7U8VElFV0='
WHERE
key_id = '8152df30d2263887a02f4a0041a1d65221efc9b5b34253ae0c218705c0db4be6'
AND (
token = 'vshCbOf7kw1deLBT9L4dGflr+j0c7/PL+O7U8VElFV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)