UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QKHUOqjs8fhXzo1jMY8h81ETjkhtbJJIOAB5r40Gmo8='
WHERE
key_id = 'b42d504bd82f56c45571e0efe3b351a59de016f3e74dfddbff4ec5a9122d5c2f'
AND (
token = 'QKHUOqjs8fhXzo1jMY8h81ETjkhtbJJIOAB5r40Gmo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)