UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kk5ix23BkkJVs7uRPcOPodYR4Bb0CN8fd9u8zUQ0Bf8='
WHERE
key_id = '1dd00122a5c0d92f845f9607b985ad11500f0bf5136ee8446646e56544b5fc68'
AND (
token = 'Kk5ix23BkkJVs7uRPcOPodYR4Bb0CN8fd9u8zUQ0Bf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)