UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mZAZsAtA81MbAzN/1ElbYWDi00IRRAEyNUFUrCqKmTU='
WHERE
key_id = '8f4cf437c3251242136064e349629ce9fc3a547d6d09fb93ce5f769e4c223e16'
AND (
token = 'mZAZsAtA81MbAzN/1ElbYWDi00IRRAEyNUFUrCqKmTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)